// app.js
App({
    onLaunch: function () {
        // 展示本地存储能力
        const logs = wx.getStorageSync('logs') || []
        logs.unshift(Date.now())
        wx.setStorageSync('logs', logs)

        // 登录
        wx.login({
            success: res => {
                // 发送 res.code 到后台换取 openId, sessionKey, unionId
                console.log('登录成功:', res.code);
                // 模拟获取用户信息成功
                wx.setStorageSync('userInfo', {
                    nickName: '用户123456',
                    avatarUrl: '/assets/icons/avatar.png'
                });
            }
        })
    },
    globalData: {
        userInfo: null,
        baseUrl: 'http://120.76.157.24/api/v1'
    }
}) 